package com.woniuxy.counter.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.woniuxy.counter.entity.HoldStock;
import com.woniuxy.counter.entity.ResponseEntity;
import com.woniuxy.counter.service.HoldStockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("holdStock")
public class HoldStockController {
    @Autowired
    private HoldStockService holdStockService;

    @GetMapping("getHoldStock")
    public ResponseEntity<?> getHoldStock(int userId) {
        QueryWrapper<HoldStock> wrapper=new QueryWrapper<>();
        wrapper.eq("user_id",userId);
        List<HoldStock> holdStocks = holdStockService.list(wrapper);
        return new ResponseEntity<>(holdStocks);
    }
}
